//
//  ActionGoodsNameView.m
//  phmall
//
//  Created by admin on 2017/12/3.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "ActionGoodsNameView.h"

@implementation ActionGoodsNameView

-(instancetype)init{
    if (self=[super init]) {
        self.backgroundColor=[UIColor whiteColor];
        
        self.name=[[UILabel alloc] init];
        self.name.text=@"Clinique 保湿纯原浆水果多色保湿润唇膏(新款)热卖";
        self.name.font=[UIFont systemFontOfSize:15];
        self.name.numberOfLines=0;
        [self addSubview:self.name];
        
        self.like=[[UIImageView alloc]init];
        [self addSubview:self.like];
        self.like.image=[UIImage imageNamed:@"点赞"];
        
        
        self.likeNumber=[[UILabel alloc] init];
        self.likeNumber.text=@"500";
        self.likeNumber.textAlignment=NSTextAlignmentCenter;
        self.likeNumber.textColor=[UIColor blackColor];
        self.likeNumber.font=[UIFont systemFontOfSize:13];
        [self addSubview:self.likeNumber];
        
        
        self.integral=[[UILabel alloc] init];
        self.integral.text=[NSString stringWithFormat:@"%@ %@ %@",Localized(@"赠送"),@"666",Localized(@"积分")];
        self.integral.textColor=[UIColor colorWithHexString:@"#adadad"];
        self.integral.font=[UIFont systemFontOfSize:13];
        [self addSubview:self.integral];
        
        self.brand=[[UILabel alloc] init];
        self.brand.text=[NSString stringWithFormat:@"%@:%@",Localized(@"品牌"),@"adidas"];
        self.brand.textColor=[UIColor colorWithHexString:@"#adadad"];
        self.brand.font=[UIFont systemFontOfSize:13];
        [self addSubview:self.brand];
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }
    [self.like mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-10);
        make.top.offset(15);
        make.width.offset(60);
        make.height.offset(40);
    }];
    
    [self.likeNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.like).offset(0);
        make.top.equalTo(self.like);
        make.bottom.equalTo(self.like.mas_centerY);
    }];
    
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).with.offset(15).priorityHigh();
        make.left.equalTo(self).with.offset(15);
        make.right.equalTo(self.like.mas_left).with.offset(-15);
    }];
    
   
    [self.integral mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.name);
        make.top.equalTo(self.name.mas_bottom).offset(10);
    }];
    
    [self.brand mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.bottom.equalTo(self.integral.mas_bottom).offset(0);
    }];
    
}
-(void)setModel:(DetailsModel *)model{
    
}
@end
